﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace HeathCareSystem.wuc
{
    public partial class wucBenhNhanMoi : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnThem_Click(object sender, EventArgs e)
        {
            string gioiTinh;
            string tinhTrangHonNhan;
            BenhNhanDTO bnDTO = new BenhNhanDTO();
            bnDTO.maBenhNhan = txtMa.Text;
            bnDTO.hoTen = txtTen.Text;
            bnDTO.ngaySinh = DateTime.Parse(txtNgay.Text);
            bnDTO.diaChi = txtDiaChi.Text;
            bnDTO.soDienThoai = txtDienThoai.Text;
            if(rbtnNam.Checked == true)
                gioiTinh = rbtnNam.Text;
            else
            {
                gioiTinh = rbtnNu.Text;
            }
            bnDTO.gioiTinh = gioiTinh;

            if (rbtnAlone.Checked == true)
                tinhTrangHonNhan = rbtnAlone.Text;
            else
            {
                tinhTrangHonNhan = rbtnMiery.Text;
            }
            bnDTO.tinhTrangHonNhan = tinhTrangHonNhan;
            bnDTO.queQuan = ddlQue.Text;
            bnDTO.maTaiKhoan = 1;

            if (new BenhNhanBUS().ThemBenhNhan(bnDTO))
                lblThongBao.Text = "Them thanh cong";
            else
            {
                lblThongBao.Text = "Them that bai!";
            }
        }
    }
}